Skip to main content link. Accesskey S
  • Help
  • HCL Logo
  • HCL Notes and Domino Application Development wiki
  • THIS WIKI IS READ-ONLY. Individual names altered for privacy purposes.
  • HCL Forums and Blogs
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • API Documentation
Search
Community Articles > Developing Applications > Developing XPage Applications > XPage Tutorials > Testing XPages: Quick Start
  • Share Show Menu▼
  • Subscribe Show Menu▼

Recent articles by this author

Community articleTesting XPages: Quick Start
Added by ~John Optumilitgon | Edited by ~John Optumilitgon on April 22, 2013 | Version 29
expanded Abstract
collapsed Abstract
No abstract provided.
ShowTable of Contents
HideTable of Contents
  • 1 Configuring Test Project
  • 2 Renaming Test Project
  • 3 Running Test Framework and fixing fails
This article will go through the steps required to set up a provided test project to test your custom XPages controls.

In this tutorial we will be using an example control project: com.example.greenbox, but same steps can be applied to other controls.
To follow this tutorial, import the com.example.greenbox project which can be found in the article's Attachments list.

Configuring Test Project


In the MANIFEST.MF in the test project, remove dependency on the com.example.xsp project
Add a new dependency for your control (in our case it's com.example.greenbox) so it looks like so:

Plug-ins dependency

In the project open WEB-INF/xsp.properties file
Change the dependency from com.example.library to your own (in our case it's com.example.greenbox.library)
It should look like so:
xsp.library.depends=\
    com.ibm.xsp.core.library,\
    com.ibm.xsp.extsn.library,\
    com.ibm.xsp.designer.library,\
    com.ibm.xsp.domino.library,\
    com.example.greenbox.library
Open config.properties in the test project package com.ibm.xsp.test.framework
Change the target.library and NamingConvention.package.prefix to your own control
(in our case it's com.example.greenbox.library and com.example.greenbox respectively). It should look like so:
# The XspLibrary.getLibraryId() value of the library 
# whose contents should be tested, defaults to none, 
# meaning that only local xsp-configs are loaded.
target.library=com.example.greenbox.library

# Package name and component-type prefix, like "com.ibm.xsp" or 
# "com.ibm.xsp.extlib", used in the NamingConventionTest
#NamingConvention.package.prefix=

NamingConvention.package.prefix=com.example.greenbox

# Extra libraries whose xsp-config files should be loaded
# when creating a registry 
extra.library.depends.designtime.nonapplication=\
    com.ibm.xsp.core.library,\
    com.ibm.xsp.extsn.library,\
    com.ibm.xsp.designer.library,\
    com.ibm.xsp.domino.library
In the test project, open pages/simpleTestOfExampleControl.xsp
Change the XPage(prefix, namespace, tag) to use your own control. In our case it should look like so:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:eg="http://greenbox.example.com/xsp/control">
    <eg:greenboxControl/>
</xp:view>
Delete the contents of the gen folder in the test project.
Re-run the tests. Refresh the test project. gen folder should now contain generated Java Classes for the corresponding XPage above.

Before we continue to the next section, we need to fix a compile error in the ExamplePrintTagNamesAndProps.
In the test project, open ExamplePrintTagNamesAndProps.java from the xsp.example.test.version package.
Somewhere around line #22 change the following code to use your own control (in our case it's Greenbox Library).
Change from:
tagsAndProps = filterToDependsLibrary(registry, (new ExampleLibrary()).getLibraryId(), tagsAndProps);

to
tagsAndProps = filterToDependsLibrary(registry, (new GreenboxLibrary()).getLibraryId(), tagsAndProps);
You might need to organize your imports (Ctrl+Shift+O) to remove unused references to the old control.

Renaming Test Project


The sample test project was named to use with the example control. In this section we will go through the steps to rename the test project to use with our control.
For the tutorial purpose, we will be renaming the project to our Greenbox example control but same steps can applied to your own control.
We will start with renaming the project name and proceed to packages after.

Right click on the com.example.junit.tests project. Refactor -> Rename


Name the project to be com.example.greenbox.junit.tests


We are going to do the same for the packages in the test project.

Right click on the xsp.example.test package. Refactor -> Rename


Name the package to be xsp.example.greenbox.test


Now your test project structure should look like so:


The com.ibm.xsp.test.framework package should not be renamed as the name is required by the test framework.

Now we are going to rename Java Classes to reflect the the use of our control.
Right click on ExampleTestSuite.java in the com.example.greenbox.test package. Refactor -> Rename


Name it to be GreenboxTestSuite like so


Follow the same pattern for the remaining Java Classes: replacing Example[...] with Greenbox[...].
So that the test project structure looks like so:


Running Test Framework and fixing fails

expanded Attachments (1)
collapsed Attachments (1)
File TypeSizeFile NameCreated OnDelete file
application/x-zip 14 KB com.example.greenbox.zip 4/2/13, 9:54 AM
expanded Versions (85)
collapsed Versions (85)
Version Comparison     
VersionDateChanged by              Summary of changes
85Apr 23, 2014, 1:19:48 PM~Fred Ektumilitetsi  
84Jan 18, 2014, 6:13:52 PM~Paul Kiretex  
83Sep 13, 2013, 3:23:26 PM~Elizabeth Cisboosiburakol  
82May 23, 2013, 2:29:22 PM~John Optumilitgon  
81May 16, 2013, 12:06:24 PM~John Optumilitgon  
79May 16, 2013, 11:54:51 AM~John Optumilitgon  
78May 16, 2013, 11:49:07 AM~John Optumilitgon  
77May 10, 2013, 5:59:55 PM~John Optumilitgon  
76May 10, 2013, 5:52:32 PM~John Optumilitgon  
75May 10, 2013, 5:38:28 PM~John Optumilitgon  
74May 10, 2013, 5:33:31 PM~John Optumilitgon  
73May 10, 2013, 5:18:25 PM~John Optumilitgon  
72May 10, 2013, 5:16:40 PM~John Optumilitgon  
71May 10, 2013, 4:56:41 PM~John Optumilitgon  
70May 10, 2013, 4:42:32 PM~John Optumilitgon  
69May 10, 2013, 4:25:21 PM~John Optumilitgon  
68May 10, 2013, 4:23:08 PM~John Optumilitgon  
67May 10, 2013, 4:22:32 PM~John Optumilitgon  
66May 10, 2013, 4:22:02 PM~John Optumilitgon  
65May 10, 2013, 4:20:03 PM~John Optumilitgon  
64May 10, 2013, 4:19:33 PM~John Optumilitgon  
63May 10, 2013, 4:18:48 PM~John Optumilitgon  
62May 10, 2013, 4:18:19 PM~John Optumilitgon  
61May 10, 2013, 4:16:23 PM~John Optumilitgon  
60May 10, 2013, 4:14:19 PM~John Optumilitgon  
59May 10, 2013, 4:13:26 PM~John Optumilitgon  
58May 10, 2013, 3:52:14 PM~John Optumilitgon  
57May 9, 2013, 1:22:51 PM~John Optumilitgon  
56May 9, 2013, 1:20:23 PM~John Optumilitgon  
55May 9, 2013, 1:19:37 PM~John Optumilitgon  
54May 9, 2013, 1:17:31 PM~John Optumilitgon  
53May 9, 2013, 1:14:00 PM~John Optumilitgon  
52May 9, 2013, 1:08:46 PM~John Optumilitgon  
51May 9, 2013, 1:07:48 PM~John Optumilitgon  
50May 9, 2013, 1:04:15 PM~John Optumilitgon  
49May 9, 2013, 12:57:40 PM~John Optumilitgon  
48May 9, 2013, 12:54:39 PM~John Optumilitgon  
47May 9, 2013, 12:44:39 PM~John Optumilitgon  
46May 9, 2013, 12:33:21 PM~John Optumilitgon  
45May 3, 2013, 2:25:08 PM~John Optumilitgon  
44Apr 25, 2013, 1:45:19 PM~John Optumilitgon  
43Apr 24, 2013, 9:17:34 AM~John Optumilitgon  
42Apr 23, 2013, 10:05:44 AM~John Optumilitgon  
41Apr 23, 2013, 9:28:20 AM~John Optumilitgon  
40Apr 22, 2013, 1:33:56 PM~John Optumilitgon  
39Apr 22, 2013, 12:14:12 PM~John Optumilitgon  
38Apr 22, 2013, 12:07:53 PM~John Optumilitgon  
37Apr 22, 2013, 12:02:06 PM~John Optumilitgon  
36Apr 22, 2013, 10:31:45 AM~John Optumilitgon  
35Apr 22, 2013, 10:21:30 AM~John Optumilitgon  
34Apr 22, 2013, 10:21:07 AM~John Optumilitgon  
33Apr 22, 2013, 10:20:06 AM~John Optumilitgon  
32Apr 22, 2013, 10:16:22 AM~John Optumilitgon  
31Apr 22, 2013, 10:13:22 AM~John Optumilitgon  
30Apr 22, 2013, 10:09:01 AM~John Optumilitgon  
This version (29)Apr 22, 2013, 10:08:18 AM~John Optumilitgon  
28Apr 5, 2013, 2:00:12 PM~John Optumilitgon  
27Apr 5, 2013, 10:48:57 AM~John Optumilitgon  
26Apr 5, 2013, 10:46:32 AM~John Optumilitgon  
25Apr 5, 2013, 10:40:21 AM~John Optumilitgon  
24Apr 4, 2013, 12:48:37 PM~John Optumilitgon  
23Apr 4, 2013, 12:46:57 PM~John Optumilitgon  
22Apr 4, 2013, 12:38:54 PM~John Optumilitgon  
21Apr 4, 2013, 12:38:35 PM~John Optumilitgon  
20Apr 4, 2013, 12:36:04 PM~John Optumilitgon  
19Apr 3, 2013, 3:04:31 PM~John Optumilitgon  
18Apr 3, 2013, 3:03:54 PM~John Optumilitgon  
17Apr 3, 2013, 9:02:29 AM~John Optumilitgon  
16Apr 3, 2013, 9:02:03 AM~John Optumilitgon  
15Apr 3, 2013, 9:00:55 AM~John Optumilitgon  
14Apr 3, 2013, 8:52:17 AM~John Optumilitgon  
13Apr 2, 2013, 10:53:36 AM~John Optumilitgon  
12Apr 2, 2013, 10:51:08 AM~John Optumilitgon  
11Apr 2, 2013, 10:46:11 AM~John Optumilitgon  
10Apr 2, 2013, 10:40:16 AM~John Optumilitgon  
9Apr 2, 2013, 10:39:42 AM~John Optumilitgon  
8Apr 2, 2013, 10:39:10 AM~John Optumilitgon  
7Apr 2, 2013, 10:37:48 AM~John Optumilitgon  
6Apr 2, 2013, 10:36:16 AM~John Optumilitgon  
5Apr 2, 2013, 10:35:21 AM~John Optumilitgon  
4Apr 2, 2013, 10:28:25 AM~John Optumilitgon  
3Apr 2, 2013, 10:24:03 AM~John Optumilitgon  
2Apr 2, 2013, 10:17:43 AM~John Optumilitgon  
1Apr 2, 2013, 9:49:18 AM~John Optumilitgon  
1Apr 2, 2013, 9:53:14 AM~John Optumilitgon  
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedAbout
  • HCL Software
  • HCL Digital Solutions community
  • HCL Software support
  • BlogsDigital Solutions blog
  • Community LinkHCL Software forums and blogs
  • About HCL
  • Privacy
  • Accessibility